package org.example.singleton;

public class lazySingle_DCL {
    // 懒汉式  DCL double check lock 双重检查锁
    // 注意和加synchronized的区别
    private volatile static lazySingle_DCL s;

    private lazySingle_DCL(){}

    public static lazySingle_DCL getInstance(){
        if(s == null){
            synchronized (lazySingle_DCL.class){
                if(s == null){
                    s = new lazySingle_DCL();
                }
            }
        }
        return s;
    }
}

